<template>
    <div class="pass">
      <!-- 通行证管理 -->
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>人员信息</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
  
  
    <el-card>
      <div class="height">
        <el-form :label-position="labelPosition" label-width="80px">
  
          <el-form-item label="姓名">
            <el-input v-model="formInline.uname"></el-input>
          </el-form-item>
  
          <el-form-item label="车牌号">
            <el-input v-model="formInline.idcar"></el-input>
          </el-form-item>
  
          <el-form-item label="体温">
            <el-input v-model="formInline.temperature"></el-input>
          </el-form-item>
          
          <el-form-item label="进入时间">
            <el-date-picker v-model="formInline.intime" type="datetime" placeholder="选择日期时间" align="right"
                    :picker-options="pickerOptions">
                </el-date-picker>
          </el-form-item>
  
          <el-form-item label="电话号码">
            <el-input v-model="formInline.phone"></el-input>
          </el-form-item>
  
          <el-form-item label="出去时间">
             <el-date-picker v-model="formInline.outtime" type="datetime" placeholder="选择日期时间" align="right"
                    :picker-options="pickerOptions">
                </el-date-picker>
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="formInline.note"></el-input>
          </el-form-item>
  
  
          <div class="button">
            <el-form-item>
              <el-button color="red" @click="postAddCar">保存</el-button>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="back">返回</el-button>
            </el-form-item>
          </div>
  
  
  
        </el-form>
      </div>
    </el-card>
  
  
  </template>
  
    <script>
    import {
      postAddPersonApi,
      postAddCarApi
    }from '../api/index1.js'
    import { ElMessage } from "element-plus";
  export default {
    data() {
      return {
        formInline: {
         
           temperature:'',
            uname:'',
            outtime:'',
            intime:'',
            note:'',
            idcar:'',
            phone:''
        }
      };
    },
    methods: {
      back() {
        this.$router.push({
          path: "../views/userRegister"//要跳转的页面的路由
        })
      },
      //查询
      onSubmit() {
        console.log('submit!');
      },
      //添加数据
      postAddCar(){
        let obj={
          uname:this.formInline.uname,
          phone:this.formInline.phone,
          temperature:this.formInline.temperature,
          intime:this.formInline.intime,
          idcar:this.formInline.idcar,
          note:this.formInline.note,
          outtime:this.formInline.outtime,

        }
        postAddCarApi(obj).then((res) => {
          console.log(res)
	     if (res.code == 20000) {
          ElMessage({
            message: "添加成功",
            type: "success",
          });
	      }
        //创建对象传递，使用后自动销毁 不用手动清空表单了
              this.$router.push({
        // path:'../views/noticeUpdate',
        name: "carRegister",
        // params: {
        //   id: id,
        //   time: time,
        //   title: title,
        //   message: message,
        // },
      });
	 })
      },
    // changeStatus(id, status) {
    //   console.log(id + status);

    //   let obj = {
    //     id: id,
    //     status: status,
    //   };
    //   changePassStatusApi(obj).then((res) => {
    //     console.log(res);
    //     if (res.code == 20000) {
    //       this.getPassList();
    //       ElMessage({
    //         message: "更新成功",
    //         type: "success",
    //       });
    //     }
    //   });
    // },
  
    }
  
  };
  </script>
  
    <style lang="less" scoped>
    .el-form {
      width: 800px;
    }
    
    .notice {
      margin-top: 10px;
      font-weight: bold;
    }
    
    .height {
      margin-top: 20px;
    }
    
    .height {
      line-height: 10px;
    }
    
    .el-input {
      width: 220px;
    }
    
    .el-card {
      margin-top: 10px;
    }
    
    .button {
      display: flex;
    }
    </style>
  